<?php 
require_once("./bm-header.php");
?>
<center><h2>My Contest Schedule</h2></center>
<div id="MyCResults">
<?php
//require_once("./include/set_get_key.php");
$bm_t_ojid=$_SESSION['user_id'];
$sql="
SELECT *
FROM `bm_team`, `bm_contest` 
WHERE `bm_team`.`bm_t_ojid`='$bm_t_ojid' AND `bm_team`.`bm_c_id`=`bm_contest`.`bm_c_id`
ORDER BY `bm_team`.`bm_c_id` DESC;
";
$result=mysql_query($sql) or die(mysql_error());
$now=time();
echo "<center><table width=90% border=1>";
echo "<tr><td>ContestID<td>Title[报名信息]<td>StartReg<td>EndReg<td>Status<td>Kind"; 
echo "</tr>";
while($row=mysql_fetch_object($result))
{
	echo "<tr>";
	echo "<td><a href='./contest.php?cid=$row->bm_c_id'>".$row->bm_c_id."</a></td>";
	echo "<td><a href='./results.php?cid=$row->bm_c_id'>".$row->bm_c_title."</a></td>";
	echo "<td>".$row->bm_c_startreg."</td>";
	echo "<td>".$row->bm_c_endreg."</td>";
	$SRtime=strtotime($row->bm_c_startreg);
	$ERtime=strtotime($row->bm_c_endreg);
	echo "<td>";
	if_reg_ing($SRtime, $ERtime, $now);
	echo "</td>";
	echo "<td>".($row->bm_c_kind=="0"?"组队赛":"个人赛")."</td>";
	echo "</tr>";
}
mysql_free_result($result);
echo "</table></center>";
?>
</div>
<?php
require_once("bm-footer.php");
?>